﻿@model Article
@Html.Extra()
@{
    Layout = "~/Views/Shared/OA/_Detail.cshtml";

    var catalog = (Catalog)ViewBag.Catalog;
    var config = SerializationHelper.JsonDeserialize<JObject>(catalog.Config);
}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "修改", Power = "CMS_Article_Modify" })
    @Html.MyNet().Button(new ButtonOptions { Text = "返回", Click = "backRead", Icon = "back" })
}
@section Main
{
    <div class="sumary">
        <ul>
            @{
                <li>
                    <h1>
                        @Model.Title
                    </h1>
                </li>
            }
            @if (config.GetBoolean("Receipt_EditVisible"))
            {
                <li>接收人:
                    @if (string.IsNullOrEmpty(Model.Receiptants))
                    {
                        @("全体员工")
                    }
                    else
                    {
                        @JsonHelper.GetValuesString(Model.Receiptants, "Text")
                    }
                </li>
            }
            @if (config.GetBoolean("FullTitle_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("FullTitle_Display")) ?
                    "完整标题" :
                    config.GetString("FullTitle_Display"))
                    ：
                    @Model.FullTitle
                </li>
            } 
            @if (config.GetBoolean("SubTitle_EditVisible"))
            {
                <li>
                    @( string.IsNullOrEmpty(config.GetString("SubTitle_Display")) ?
                    "子标题" :
                    config.GetString("SubTitle_Display"))
                    ：
                    @Model.SubTitle
                </li>
            }
            @if (config.GetBoolean("Keyword_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("Keyword_Display")) ?
                    "关键字" :
                    config.GetString("Keyword_Display"))
                    ：
                    @Model.Keyword
                </li>
            }
            @if (config.GetBoolean("Tag_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("Tag_Display")) ?
                     "标签" :
                     config.GetString("Tag_Display"))
                    ：
                    @Model.Tag
                </li>
            }
            @if (config.GetBoolean("Origin_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("Origin_Display")) ?
                    "来源" :
                    config.GetString("Origin_Display"))
                    ：
                    @Model.Origin
                </li>
            }
            @if (config.GetBoolean("Author_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("Author_Display")) ?
                    "作者" :
                    config.GetString("Author_Display"))
                    ：
                    @Model.Author
                </li>
            }
            @if (config.GetBoolean("Summary_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("Summary_Display")) ?
                    "摘要" :
                    config.GetString("Summary_Display"))
                    ：
                    @Model.Summary
                </li>
            }
            @if (config.GetBoolean("ExtField01_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("ExtField01_Display")) ?
                    "扩展字段一" :
                    config.GetString("ExtField01_Display"))
                    ：
                    @Model.ExtField01
                </li>
            }
            @if (config.GetBoolean("ExtField02_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("ExtField02_Display")) ?
                    "扩展字段二" :
                    config.GetString("ExtField02_Display"))
                    ：
                    @Model.ExtField02
                </li>
            }
            @if (config.GetBoolean("ExtField03_EditVisible"))
            {
        
                <li>
                    @(string.IsNullOrEmpty(config.GetString("ExtField03_Display")) ?
                    "扩展字段三" :
                    config.GetString("ExtField03_Display"))
                    ：
                    @Model.ExtField03
                </li>
            }
            @if (config.GetBoolean("ExtField04_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("ExtField04_Display")) ?
                    "扩展字段四" :
                    config.GetString("ExtField04_Display"))
                    ：
                    @Model.ExtField04
                </li>
            }
            @if (config.GetBoolean("City_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("City_Display")) ?
                    "城市" :
                    config.GetString("City_Display"))
                    ：
                    @CommonAppService.Current.GetSettingEnumName("CMS_City", Model.City)
                </li>
            }
            @if (config.GetBoolean("PublishTime_EditVisible"))
            {
                <li>
                    @(string.IsNullOrEmpty(config.GetString("PublishTime_Display")) ?
                    "发布时间" :
                    config.GetString("PublishTime_Display"))
                    ：
                    @StringHelper.FormatDate(Model.PublishTime)
                </li>
            }
        </ul>
    </div>
    @if (config.GetBoolean("Text_EditVisible"))
    {
        <div class="html">
            @if (Model.ArticleTexts.Count > 0)
            {
                foreach (var item in Model.ArticleTexts)
                {
                @Html.Raw(item.Text)
                }
            }
        </div>
    }
}
<style>
    .sumary { line-height: 27px; padding: 0 20px 20px 20px; border-bottom: solid 1px #DADADA; }
    .sumary h1 { font-size: 18px; margin-bottom: 5px; }
    .html { line-height: 30px; padding: 20px; font-size: 14px; }
    .html p { text-indent: 2em; margin-bottom: 10px; }
</style>
<script>

    var url = "/CMS/Article/";

    function modify()
    {
        nav(url + "Modify?Id=@Model.Id");
    }

    function backRead()
    {
        back(true);
    }
  
</script>
